package ui;

import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;

public class Welcome extends JFrame{
    private JProgressBar progressbar;

    public void setProgressbarValue(int value) {
        this.progressbar.setValue(value);
    }

    public Welcome() {
        init();//调用时进行初始化界面操作
    }
    /*1.初始化界面*/
    private void init() {
        setSize(430, 300);
        JPanel pane = new JPanel(new BorderLayout());
        ImageIcon ico = new ImageIcon(getClass().
                getResource("pic/welcome.png"));
        JLabel l = new JLabel(ico);
        pane.add(BorderLayout.CENTER, l);
        //添加有线边框,颜色设置成灰色
        pane.setBorder(new LineBorder(Color.GRAY));
        //去掉边框
        this.setUndecorated(true);
        this.setContentPane(pane);
        this.setLocationRelativeTo(null);
        progressbar = new JProgressBar();
        progressbar = new JProgressBar();
        // 显示当前进度值信息
        progressbar.setStringPainted(true);
        // 设置进度条边框不显示
        progressbar.setBorderPainted(false);
        // 设置进度条的前景色
        progressbar.setForeground(new Color(0, 210, 160));
        // 设置进度条的背景色
        progressbar.setBackground(new Color(190, 190, 190));
        progressbar.setValue(0);
        pane.add(BorderLayout.SOUTH,progressbar);

    }

}
